<?php


namespace app\common\validate;

use think\Validate;

class Cate extends Validate
{
    //全局验证规则
    protected $rule = [
        'catename|栏目名称' => 'require|unique:cate',
        'sort|排序' => 'require|number'
    ];

    //栏目添加验证场景
    public function sceneAdd()
    {
        return $this->only(['catename','sort']);
    }

    //排序验证场景
    public function sceneSort()
    {
        return $this->only(['sort']);
    }

    //栏目更新验证场景
    public function sceneEdit()
    {
        return $this->only(['catename']);
    }

}